package com.example.inprinciple.singleResponsibility.test;


/**
 * 创建日期：2022/6/3 0003 16:03
 *
 * @author tony.sun
 * 类说明：
 */
public class SingleResponsibility2B {
    public static void main(String[] args) {
        RoadVehicleB vehicle = new RoadVehicleB();
        AirVehicleB vehicle2 = new AirVehicleB();
        WaterVehicleB vehicle3 = new WaterVehicleB();
        vehicle.userBy("汽车");

        vehicle2.userBy("飞机");
        vehicle3.userBy("船");
    }
}

class  RoadVehicleB{
    public void userBy(String name) {
        System.out.println(name+"在公路上跑");
    }
}
class  AirVehicleB{
    public void userBy(String name) {
        System.out.println(name+"在天上飞");
    }
}
class  WaterVehicleB{
    public void userBy(String name) {
        System.out.println(name+"在水上游");
    }
}
